package com.qd.common.panda.domain.entity.carpark;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.cdqidi.util.page.BaseQuery;
import com.cdqidi.valid.group.DefaultGroup;
import com.cdqidi.valid.group.DeleteGroup;
import com.cdqidi.valid.group.UpdateGroup;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.math.BigDecimal;

/**
 * 预约设置
 *
 * @author sjk
 */
@EqualsAndHashCode(callSuper = true)
@Getter
@Setter
public class CarParkAppointmentSetDTO extends BaseQuery {

    @ExcelIgnore
    @JsonIgnore
    private static final String EXCEL_TITLE = "预约设置";
    /**
     * 主键
     */
    @ExcelProperty(value = {EXCEL_TITLE, "停车场标识"})
    @NotBlank(message = "停车场标识不能为空", groups = {DeleteGroup.class, UpdateGroup.class})
    @Size(max = 50, message = "停车场标识长度不能超过{max}位", groups = {DeleteGroup.class, UpdateGroup.class})
    @JsonProperty("pId")
    private String pId;
    /**
     * 预约时长
     */
    @ExcelProperty(value = {EXCEL_TITLE, "预约时长"})
    @NotNull(message = "预约时长不能为空", groups = DefaultGroup.class)
    private Integer time;
    /**
     * 预约金额
     */
    @ExcelProperty(value = {EXCEL_TITLE, "预约金额"})
    @NotNull(message = "预约金额不能为空", groups = DefaultGroup.class)
    private BigDecimal amount;
    /**
     * 显示金额
     */
    private String amountDisplay;
    /**
     * 预约车位数量
     */
    @NotNull(message = "预约车位数量不能为空", groups = DefaultGroup.class)
    private Integer num;
    /**
     * 已使用数量
     */
    private Integer usedNum;

    @Override
    public void freeData() {
        this.pId = null;
        this.time = null;
        this.amount = null;
        this.amountDisplay = null;
        this.num = null;
        this.usedNum = null;
        super.freeData();
    }
}
